package com.centaline.androidsalesblog.rx.request;

import com.centaline.androidsalesblog.constants.AppNameType;
import com.centaline.androidsalesblog.constants.SourceType;
import com.centaline.androidsalesblog.model.businissobject.AppUpdateBo;
import com.centaline.androidsalesblog.model.businissobject.PostImgBo;
import com.centaline.androidsalesblog.model.businissobject.RegionPostBo;
import com.centaline.androidsalesblog.model.databaseobject.CityDo;
import com.centaline.androidsalesblog.model.databaseobject.StaffDo;
import com.centaline.androidsalesblog.model.responseobject.AdRo;
import com.centaline.androidsalesblog.model.responseobject.BizGlobalRo;
import com.centaline.androidsalesblog.model.responseobject.BizUnitRo;
import com.centaline.androidsalesblog.model.responseobject.CollectInfoListRo;
import com.centaline.androidsalesblog.model.responseobject.MetroRo;
import com.centaline.androidsalesblog.model.responseobject.NewRegionRo;
import com.centaline.androidsalesblog.model.responseobject.PersonalizeRo;
import com.centaline.androidsalesblog.model.responseobject.RegionRo;
import com.centaline.androidsalesblog.model.responseobject.ReservationRo;
import com.centaline.androidsalesblog.model.responseobject.SearchDataRo;
import com.centaline.androidsalesblog.model.responseobject.SimpleUserCenterRo;
import com.centaline.androidsalesblog.model.responseobject.SmsRo;
import com.centaline.androidsalesblog.model.responseobject.VerificationCodeRo;

import java.util.ArrayList;

import rx.Observable;

/**
 * 请求
 * Created by guilin on 16/1/21.
 */
public final class RxRequest {

    private RxRequest() {
        //Utility Class
    }

    /**
     * app 升级
     */
    public static Observable<AppUpdateBo> appUpdate(Class<?> tag) {
        return Observable.create(new RequestAppUpdateOnSubscribe(tag));
    }

    /**
     * 城市列表
     *
     * @param tag 标签
     */
    public static Observable<ArrayList<CityDo>> cityList(Class<?> tag) {
        return Observable.create(new RequestCityOnSubscribe(tag));
    }

    /**
     * 全局配置
     */
    public static Observable<BizGlobalRo> bizGlobal(Class<?> tag) {
        return Observable.create(new RequestBizGlobalOnSubscribe(tag));
    }

    /**
     * 城市差异配置
     */
    public static Observable<BizUnitRo> bizUnit(Class<?> tag) {
        return Observable.create(new RequestBizUnitOnSubscribe(tag));
    }

    /**
     * 首页模块
     *
     * @param tag 标签
     * @return Observable
     */
    public static Observable<PersonalizeRo> personalize(Class<?> tag) {
        return Observable.create(new RequestPersonalizeOnSubscribe(tag));
    }

    /**
     * 地铁
     *
     * @param tag 标签
     * @return Observable
     */
    public static Observable<MetroRo> metro(Class<?> tag) {
        return Observable.create(new RequestMetroOnSubscribe(tag));
    }

    /**
     * 区域
     *
     * @param tag 标签
     * @return Observable
     */
    public static Observable<RegionRo> region(Class<?> tag) {
        return Observable.create(new RequestRegionOnSubscribe(tag));
    }

    /**
     * SearchData
     *
     * @param tag 标签
     * @return Observable
     */
    public static Observable<SearchDataRo> searchData(Class<?> tag) {
        return Observable.create(new RequestSearchDataOnSubscribe(tag));
    }

    /**
     * 租售图片列表
     *
     * @param tag    标签
     * @param postId 租售id
     * @return Observable
     */
    public static Observable<ArrayList<PostImgBo>> postImg(Class<?> tag, String postId) {
        return Observable.create(new RequestPostImgOnSubscribe(tag, postId));
    }

    /**
     * 广告
     */
    public static Observable<AdRo> ad(Class<?> tag) {
        return Observable.create(new RequestAdOnSubscribe(tag));
    }

    /**
     * 新房区域板块
     */
    public static Observable<NewRegionRo> newRegion(Class<?> tag) {
        return Observable.create(new RequestNewRegionOnSubscribe(tag));
    }

    /**
     * 租售小区房源数量
     */
    public static Observable<ArrayList<RegionPostBo>> regionPosts(Class<?> tag) {
        return Observable.create(new RequestRegionPostsOnSubscribe(tag));
    }

    /**
     * 获取短信验证码
     */
    public static Observable<SmsRo> sms(Class<?> tag, String mobile) {
        return Observable.create(new RequestSmsOnSubscribe(tag, mobile));
    }

    /**
     * 检查验证码
     */
    public static Observable<VerificationCodeRo> VerificationCode(Class<?> tag, String mobile, String code) {
        return Observable.create(new RequestVerificationCodeOnSubscribe(tag, mobile, code));
    }

    /**
     * 添加收藏
     */
    public static Observable<SimpleUserCenterRo> addCollect(Class<?> tag, AppNameType appNameType, SourceType sourceType,
                                                            String collectId, String collectValue, String collectUrl) {
        return Observable.create(new RequestAddCollectOnSubscribe(tag, appNameType, sourceType, collectId, collectValue, collectUrl));
    }

    /**
     * 取消收藏
     */
    public static Observable<SimpleUserCenterRo> cancelCollect(Class<?> tag, String collectId) {
        return Observable.create(new RequestCanelCollectOnSubscribe(tag, collectId));
    }

    /**
     * 收藏数量
     */
    public static Observable<CollectInfoListRo> collectInfoCount(Class<?> tag) {
        return Observable.create(new RequestCollectInfoCountOnSubccribe(tag));
    }

    /**
     * 收藏状态
     */
    public static Observable<CollectInfoListRo> collectStatus(Class<?> tag, String collectValue, String collectUrl) {
        return Observable.create(new RequestCollectInfoStatusOnSubccribe(tag, collectValue, collectUrl));
    }

    /**
     * 未约看数量
     */
    public static Observable<ReservationRo> reserveCount(Class<?> tag) {
        return Observable.create(new RequestReserveCountOnSubscribe(tag));
    }

    /**
     * 加入约看
     */
    public static Observable<SimpleUserCenterRo> addReservation(Class<?> tag, String postType, String estateCode,
                                                                String estateName, String postId) {
        return Observable.create(new RequestAddReservationOnSubscribe(tag, postType, estateCode, estateName, postId));
    }

    /**
     * 融云聊天用户信息请求
     */
    public static Observable<StaffDo> rongUserInfo(Class<?> tag, String targetId) {
        return Observable.create(new RequestStaffOnSubscribe(tag, targetId));
    }
}
